<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:70:"/home/wwwroot/www.xgw0851.com/application/index/view/cart/pinkage.html";i:1528991405;s:69:"/home/wwwroot/www.xgw0851.com/application/index/view/public/base.html";i:1527951132;}*/ ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<title><?php echo $title; ?></title>
<link rel="stylesheet" href="__PUBLIC__/xsd/css/mui.min.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/xsd/css/app.css?v1111" />

</head>
<!--/head-->
<body>


	<!--/header-->

<style>
    .mui-row.mui-fullscreen>[class*="mui-col-"] {
        height: 100%;
    }
    .mui-col-xs-3,
    .mui-col-xs-9 {
        overflow-y: auto;
        height: 100%;
    }

    .mui-segmented-control .mui-control-item {
        line-height: 50px;
        width: 100%;
    }

    .mui-control-content {
        display: block;
    }

    .mui-segmented-control.mui-segmented-control-inverted .mui-control-item.mui-active {
        background-color: #fff;
    }
    .mui-toast-container {
        bottom: 50%;
        z-index: 999999999999999999;
    }
    .mui-btn-block{
      padding: 5px;
      border: 1px solid #ccc !important;
      margin: 5px;
      -webkit-appearance: none;
    }
    .active .mui-icon{
      display: block !important;
    }
    .submitbuttonqx {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 2.876712rem;
        background-color: red;
        color: #fff;
        text-align: center;
        text-decoration: none;
        font-size: 0.410959rem;
        font-weight: bold;
        line-height: 1.315068rem;
    }
</style>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/xsd/css/checkout.css" />
<header class="mui-bar mui-bar-nav" style="z-index:7">
			<a class="mui-icon mui-icon-left-nav mui-pull-left mui-action-back"></a>
			<h1 class="mui-title">确定订单</h1>
</header>
<div class="mui-content" style="    margin-bottom:60px;">
  <div  class="checkout-section" >
      <section class="cart-address" >
          <div class="address-item"   onclick='window.location.href = "<?php echo url('index/address/index'); ?>"'   <?php if(empty($address['sex']) || ($address['sex'] instanceof \think\Collection && $address['sex']->isEmpty())): ?>style="display: none;"<?php endif; ?>>
              <h2 class="address-name" > <b ><?php echo $address['name']; ?></b> <span ><?php if($address['sex'] == '1'): ?>先生<?php else: ?>女士<?php endif; ?></span> <span ><?php echo $address['tel']; ?></span> </h2>
              <p class="address-detail" ><?php echo $address['address']; ?>-<?php echo $address['house_number']; ?></p> <span class="mui-icon mui-icon-arrowright"></span>  </div>
          <div class="address-item" onclick='window.location.href = "<?php echo url('index/address/add'); ?>"' <?php if(!(empty($address['sex']) || ($address['sex'] instanceof \think\Collection && $address['sex']->isEmpty()))): ?>style="display: none;"<?php endif; ?> > 请添加一个收货地址 <span class="mui-icon mui-icon-arrowright"></span> </div>
      </section>

  <br />
  <section class="cart-group checkout-section">
      <ul class="foodlist" style="    margin: 0;">
            <li> <span class="cellname"><?php echo get_table_field($info['goods_id'],"id","good_name","goods"); ?>-<?php echo $info['rule_name']; ?></span> <span class="cellquantity">x&nbsp;1</span> <span class="celltotal">¥<?php echo $info['rule_price']; ?></span> </li>
      </ul>
    <div class="fee" >
        <div >配送费(约<?php echo $address['disparity']; ?>公里) 满600全城免运费</div>
        <div id="freight" >¥<?php echo $address['freight']; ?></div>


    </div>

    <div class="fee" >
        <div >余额支付</div>
        <div >¥<?php echo \think\Request::instance()->session('user.balance'); ?></div>
    </div>

      <div class="total">
          <div> <span>总计 <span id="zj">¥<?php echo $info['rule_price']; ?></span>  余额 ¥<?php echo \think\Request::instance()->session('user.balance'); ?></span> &nbsp;&nbsp; </div>
          <span>实付<span style="color:red;" id="sf" class="sjzf"></span></span>
      </div>
  </section>






    <form  method="post"  action="<?php echo url('index/order/add'); ?>">
      <section class="checkout-section">
      <div class="mui-input-row" style="margin: 10px 5px;">
      					<textarea id="textarea" name="remark" rows="5" placeholder="备注"></textarea>
      	</div>
      </section>
      <input type="hidden" name="index_type" value="1"  />
    </form>

  </div>


  <nav class="mui-bar mui-bar-tab" style="   border-bottom: none;  background-color: #3d3d3f; ">
      <span style="    color: #fff;font-size: .48rem;line-height: 1.273333rem;padding-left: .266667rem;">待支付 <span id="dzf" class="sjzf" style="color:red"></span></span>
      <a href="javascript:" class="submitbutton" style="right: 2.876712rem;" >确定下单</a>
      <a  class="submitbuttonqx qxdd" data-url="<?php echo url('index/index'); ?>" >取消订单</a>
  </nav>

</div>




<!--/#footer-->

<script src="__PUBLIC__/js/jquery.js"></script>
<script src="__PUBLIC__/xsd/js/mui.min.js"></script>
<script src="__PUBLIC__/xsd/js/flexible.js"></script>
<script src="__PUBLIC__/xsd/js/template.js"></script>


  <script type="text/javascript">
    $(function(){

    //实际支付价格
    var price = parseFloat("<?php echo $info['rule_price']; ?>"), balance = parseFloat("<?php echo \think\Request::instance()->session('user.balance'); ?>"),sf = '0.00'
    if(price - balance >= 0){
       sf = parseFloat(price - balance).toFixed(2)
    }
    $('.sjzf').text(sf)

    //确定下单
    $('.submitbutton').on('tap', function(){
      $('form').submit()
    })
    //取消订单
    $('.qxdd').on('tap', function(){
     var btnArray = ['否', '是'];
     mui.confirm('您确定要删除该订单吗？', '删除订单', btnArray, function(e) {
        window.location.href = "<?php echo url('index/index'); ?>"
     })
    })



    })




  </script>

<?php if(!(empty(config('shop_hours')) || (config('shop_hours') instanceof \think\Collection && config('shop_hours')->isEmpty()))): ?>
<script>
  var time_range = function (beginTime, endTime) {
    var strb = beginTime.split (":");
    if (strb.length != 2) {
      return false;
    }

    var stre = endTime.split (":");
    if (stre.length != 2) {
      return false;
    }

    var b = new Date ();
    var e = new Date ();
    var n = new Date ();

    b.setHours (strb[0]);
    b.setMinutes (strb[1]);
    e.setHours (stre[0]);
    e.setMinutes (stre[1]);

    if (n.getTime () - b.getTime () > 0 && n.getTime () - e.getTime () < 0) {
      return true;
    } else {

      mui.alert("<?php echo config('shop_hours_message'); ?>", '公告');
      $('.mui-popup-buttons').html(' ')
      $('.mui-popup-inner').css('border-radius', '13px')
      return false;
    }
  }

  var shop_hours = "<?php echo config('shop_hours'); ?>";
  var hours_arr = shop_hours.split('-');
  time_range (hours_arr[0], hours_arr[1]);

</script>
<?php endif; if(config('is_rest') == '1'): ?>
<script>
mui.alert("<?php echo config('rest_message'); ?>", '公告');
$('.mui-popup-buttons').html(' ')
$('.mui-popup-inner').css('border-radius', '13px')
</script>
<?php endif; if(empty(\think\Cookie::get('positioninit')) || (\think\Cookie::get('positioninit') instanceof \think\Collection && \think\Cookie::get('positioninit')->isEmpty())): ?>
<script type="text/javascript" src="https://3gimg.qq.com/lightmap/components/geolocation/geolocation.min.js"></script>
<script>
   var geolocation = new qq.maps.Geolocation("QQ6BZ-24HC6-ZAXSZ-MTZAU-5MU2J-HEFEH", "鲜果屋");
    geolocation.getIpLocation(showPosition, showErr)
    function showPosition(position) {
      $.getJSON("<?php echo url('index/cart/changecookie'); ?>", {name: 'positioninit', 'val': position.lat+','+position.lng}, function(json, textStatus) {});
    };
    function showErr() {
      console.log('定位失败');
    };
</script>
<?php endif; ?>

<script>
  $(function(){
    $('.subsc').click(function(){
      // $.get("<?php echo url('index/clearusersession'); ?>", function(data){
      //   if(data.code == 1){
      //     window.location.href = "http://mp.weixin.qq.com/s/-AzpDTU7eAD24-R5QUP0wg"
      //   }
      // })
      <?php if(empty($contact_qc) || ($contact_qc instanceof \think\Collection && $contact_qc->isEmpty())): ?>
            mui.alert('<img src="/public/xsd/xsdwx2.jpg" style="width:100%;">', '长按扫二维码');
          <?php else: ?>
            mui.alert('<img src="<?php echo $contact_qc; ?>" style="width:100%;">', '长按扫二维码');
      <?php endif; ?>
    })


    $('.endlimit').each(function(){
      var $this = $(this);
      var stime = $this.attr('data-endtime');
      var starttime = new Date(stime.replace(/-/g,"/"))
      setInterval(function () {
        var nowtime = new Date();
        var time = starttime - nowtime;
        if(time > 0){
          var day = parseInt(time / 1000 / 60 / 60 / 24);
          var hour = parseInt(time / 1000 / 60 / 60 % 24);
          var minute = parseInt(time / 1000 / 60 % 60);
          var seconds = parseInt(time / 1000 % 60);
          $this.html("距结束还有:<span style='color:red'>"+ day + "天" + hour + "小时" + minute + "分钟" + seconds + "秒</span>");
        }

      }, 1000);
    })

    $('.hidecartbtn').each(function(){
      var id = $(this).attr('data-id')
      $('.cartbtn'+id).hide();
    })


  })
</script>
</body>
</html>
